<template>
  <div>
    <city-header></city-header>
    <city-seach :cities="cities"></city-seach>
    <city-list :hotCities="hotCities" :cities="cities" :letter="letter"></city-list>
    <city-abc :cities="cities" @change="letterClick"></city-abc>
  </div>
</template>

<script>
import cityHeader from './components/header'
import citySeach from './components/seach'
import cityList from './components/list'
import cityAbc from './components/abc'
import axios from 'axios'

export default {
  data () {
    return {
      hotCities: [],
      cities: {},
      letter: ''
    }
  },
  components: {
    cityHeader,
    citySeach,
    cityList,
    cityAbc
  },
  mounted () {
    axios.get('/api/city.json')
      .then(this.getCityinfoSecc)
  },
  methods: {
    getCityinfoSecc (res) {
      res = res.data
      if (res.ret && res.data) {
        this.hotCities = res.data.hotCities
        this.cities = res.data.cities
      }
    },
    letterClick (res) {
      this.letter = res
    }
  }
}
</script>

<style>
</style>
